
function test(){
    let div = document.createElement("div");
    let span = document.createElement("span");
    span.innerHTML="hello world"
    div.appendChild(span)
    document.body.appendChild(div);
}

let obj = {
    tag:"div",
    children:[
        {
            tag: "span",
            children:"hello world"
        }
    ]
}
function Render(obj,root){
    let el = document.createElement(obj.tag);
    if(typeof obj.children==="string"){
        let text = document.createTextNode(obj.children);
        el.appendChild(text)
    }else if(obj.children){
       obj.children.forEach((item)=>Render(item,el))
    }
    root.appendChild(el)
}

Render(obj,document.body)
